import { ref } from "vue";

// 节流
export default function (fn, wait) {
    const timer = ref()
    return function (...args) {
        if (timer.value) {
            console.log('存在正在节流运行的函数，不予执行本次')
            return
        }
        timer.value = setTimeout(() => {
            fn(...args)
            timer.value = null
        }, wait)
    }
}